package qmese;

import java.util.HashMap;
import java.util.Map;

import qmese.parser.MatlabParser;
import qmese.parser.MatlabReader;

public class MatlabEnvironment {

	private Map<String, MatlabObject> variables;
	private MatlabReader reader;
	private MatlabParser parser;
	
	private String currentOutput = "";
	
	
	public MatlabEnvironment(){
		variables = new HashMap<String, MatlabObject>();
		reader = new MatlabReader();
		parser = new MatlabParser();
	}
	
	public void waitForInput(){
		String s = reader.readAll();
		parser.parseInput(s);
		if(parser.hasOutput()){
			currentOutput = parser.getOutput().toString();
		}
		currentOutput = "not processed";
	}
	
	public void printOutput(){
		System.out.print(currentOutput);
	}
	
	public static void main(String args[]){
		System.out.print("Matlab");
		MatlabEnvironment env = new MatlabEnvironment();
		
		while(true){
			env.waitForInput();
			env.printOutput();
		}
		
	}
}
